package com.dayuanit.dy15.lesson22.demo2;

import java.util.Comparator;

/**
 * 小狗的比较器
 * 按照名字排序
 */
public class DogComartorByName implements Comparator {

    @Override
    public int compare(Object o1, Object o2) {
        Dog dog1 = (Dog)o1;
        Dog dog2 = (Dog)o2;
        return dog1.name.compareTo(dog2.name);
    }
}
